/*
 * Copyright (c) 2006 - 2022, webrx.cn All rights reserved.
 *
 */
package cn.demo;

import java.util.stream.Stream;

/**
 * <p>Project: app2022 - Stream9
 * <p>Powered by webrx On 2022-01-26 16:34:04
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Stream9 {
    public static void main(String[] args) {
        var is = Stream.of(
                new Student(1, "李四", "男", 4),
                new Student(22, "James Gosling", "男", 68),
                new Student(2, "张三", "男", 28),
                new Student(3, "王五", "男", 38),
                new Student(1, "李四", "男", 18),
                new Student(4, "李丽", "女", 25)
        );

        //AllMatch() 返回所有元素都符合条件true,否则返回false
        //System.out.println(is.allMatch(e -> e.getAge() > 5));

        //anyMatch()
        //System.out.println(is.anyMatch(e -> e.getName().startsWith("李")));

        //noneMatch()
        //System.out.println(is.noneMatch(e -> e.getAge() > 60));

        //System.out.println(is.findFirst().get());
        System.out.println(is.findAny().get());
    }
}
